<template>
  <el-container>
    <el-header style="height:50px; width:100%">
      <div class="head">

      </div>

    </el-header>
    <el-main style="background-color:#ffffff;margin: 10px auto;width:97% ">

      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
        <!-- 未审核表格 -->
        <el-tab-pane label="未审核" name="first">

          <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange">

            <el-table-column type="selection" width="55">
            </el-table-column>

            <el-table-column prop="teacherid" label="教师编号" width="180">
            </el-table-column>
            <el-table-column prop="teacherName" label="姓名" width="180">
            </el-table-column>
            <el-table-column prop="tel" label="电话" width="180">
            </el-table-column>
            <el-table-column prop="title" label="职称" width="180">
            </el-table-column>
            <el-table-column prop="status" label="状态" width="180">
            </el-table-column>
            <el-table-column label="操作">

              <template slot-scope="scope">
                <el-button size="mini" type="success" @click="handleEdit(scope.$index, scope.row)">审核</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 同意和不同意按钮 -->
          <el-row style=" background-color: #ffffff;margin-top: 20px;">
            <div class="agree">
              <el-button type="primary" class="insertAndDelete_btn" @click="agreeAll">同意 </el-button>
              <el-button type="danger" class="insertAndDelete_btn">不同意 </el-button>
            </div>
          </el-row>
          <!-- 未审核的分页 -->
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="currentPage" :page-size="5" layout="total,  prev, pager, next, jumper" :total="totalCount ">
          </el-pagination>
        </el-tab-pane>




        <el-tab-pane label="已审核" name="second">
          <el-table :data="tableData2" border style="width: 100%">
            <el-table-column prop="teacherid" label="教师号" width="180">
            </el-table-column>
            <el-table-column prop="teacherName" label="姓名" width="180">
            </el-table-column>
            <el-table-column prop="tel" label="电话">
            </el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button size="mini" type="success" @click="cancle(scope.$index, scope.row)">取消审核</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!-- 已审核的分页 -->
          <el-pagination @size-change="handleSizeChange2" @current-change="handleCurrentChange2"
            :current-page="currentPage2" :page-size="5" layout="total, prev, pager, next, jumper" :total="totalCount2 ">
          </el-pagination>
        </el-tab-pane>
      </el-tabs>
    </el-main>
    <!-- 审核页面 -->

    <el-dialog title="教师基本信息" :visible.sync="dialogTeacherDetailVisible" width="90%" :close-on-click-modal="false">
      <!-- 卡片式查看教师信息 -->
      <el-tabs type="border-card" tab-position="left" height="550" ref="watchTeacherDetail">
        <el-tab-pane label="教师基本信息">
          <!-- div里存放基本信息 -->
          <div id="teacherDetailList" ref="teacherDetailList">
            <el-descriptions class="margin-top" title="教师基本信息" :column="3" border>

              <el-descriptions-item label="教师号">{{ teacherBaseDetail.teacherid }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-user"></i> 姓名 </template>
                {{teacherBaseDetail.teacherName}}
              </el-descriptions-item>
              <el-descriptions-item label="性别">{{ teacherBaseDetail.sex }}
              </el-descriptions-item>
              <el-descriptions-item label="出生日期">{{ teacherBaseDetail.birth }}
              </el-descriptions-item>
              <el-descriptions-item label="民族">{{ teacherBaseDetail.nation }}
              </el-descriptions-item>
              <el-descriptions-item label="身份证件号">{{ teacherBaseDetail.numberID }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-location-outline"></i> 籍贯 </template>
                {{teacherBaseDetail.place}}
              </el-descriptions-item>
              <el-descriptions-item label="政治面貌">{{ teacherBaseDetail.polstatus }}
              </el-descriptions-item>
              <el-descriptions-item label="研究生导师">{{ teacherBaseDetail.tutor }}
              </el-descriptions-item>
              <el-descriptions-item label="学位">{{ teacherBaseDetail.education }}
              </el-descriptions-item>
              <el-descriptions-item label="婚姻状况">{{ teacherBaseDetail.marriage }}
              </el-descriptions-item>
              <el-descriptions-item label="入职时间">{{ teacherBaseDetail.entryTime }}
              </el-descriptions-item>
              <el-descriptions-item label="职称">{{ teacherBaseDetail.title }}
              </el-descriptions-item>
              <el-descriptions-item>
                <template slot="label">
                  <i class="el-icon-phone-outline"></i> 电话 </template>
                {{teacherBaseDetail.tel}}
              </el-descriptions-item>
              <el-descriptions-item label="电子邮箱">{{ teacherBaseDetail.mail }}
              </el-descriptions-item>
              <el-descriptions-item label="人员状态">{{ teacherBaseDetail.status }}
              </el-descriptions-item>
              <el-descriptions-item label="密码">{{ teacherBaseDetail.pwd }}
              </el-descriptions-item>
            </el-descriptions>
          </div>
        </el-tab-pane>
        <el-tab-pane label="教师拓展信息">
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="教育背景" name="first">
              <div id="teacherDetailList" ref="teacherDetailList">
                <el-descriptions class="margin-top" :column="3" border>

                  <el-descriptions-item label="就读时间">{{ teacherBaseDetail.beginTime }}
                  </el-descriptions-item>

                  <el-descriptions-item label="毕业时间">{{ teacherBaseDetail.endTime }}
                  </el-descriptions-item>
                  <el-descriptions-item label="毕业院校">{{ teacherBaseDetail.graduationSchool }}
                  </el-descriptions-item>
                  <el-descriptions-item label="所修专业">{{ teacherBaseDetail.speciality }}
                  </el-descriptions-item>
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="荣誉称号" name="second">
              <div id="teacherDetailList" v-for="mlist in Honor_titleList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`编号:${mlist.honorNO}`" :column="3" border>

                  <el-descriptions-item label="称号名称">{{ mlist.honorName }}
                  </el-descriptions-item>

                  <el-descriptions-item label="荣誉等级">{{ mlist.honorLevel }}
                  </el-descriptions-item>
                  <el-descriptions-item label="获取时间">{{ mlist.acquireTime }}
                  </el-descriptions-item>
                  <el-descriptions-item label="证书">{{ mlist.certificate }}
                  </el-descriptions-item>
                  <el-descriptions-item label="颁发部门">{{ mlist.Issuingdep }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="年度考核" name="third">
              <div id="teacherDetailList" v-for="mlist in Annual_examinationList" :key="mlist.index"
                ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`编号:${mlist.checkNO}`" :column="3" border>

                  <el-descriptions-item label="考核项目">{{ mlist.checkName }}
                  </el-descriptions-item>

                  <el-descriptions-item label="考核结果">{{ mlist.checkResult }}
                  </el-descriptions-item>
                  <el-descriptions-item label="考核时间">{{ mlist.checkDate}}
                  </el-descriptions-item>
                  <el-descriptions-item label="考核年份">{{ mlist.checkYear }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="获奖情况" name="fourth">
              <div id="teacherDetailList" v-for="mlist in AwardList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`编号:${mlist.awardNO}`" :column="3" border>

                  <el-descriptions-item label="获奖时间">{{ mlist.awardTime }}
                  </el-descriptions-item>

                  <el-descriptions-item label="获奖名称">{{ mlist.awardName }}
                  </el-descriptions-item>
                  <el-descriptions-item label="授予单位">{{ mlist.awardIns }}
                  </el-descriptions-item>
                  <el-descriptions-item label="奖项级别">{{ mlist.awardLevel }}
                  </el-descriptions-item>
                  <el-descriptions-item label="获奖证书">{{ mlist.awardEnclosure }}
                  </el-descriptions-item>
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="科研情况" name="fifth">
              <div id="teacherDetailList" ref="teacherDetailList">
                <el-descriptions class="margin-top" v-for="mlist in Research_projectList" :key="mlist.index"
                  :title="`编号:${mlist.projectNO}`" :column="3" border>

                  <el-descriptions-item label="项目名">{{ mlist.projectName }}
                  </el-descriptions-item>

                  <el-descriptions-item label="项目经费">{{ mlist.projectFund }}
                  </el-descriptions-item>
                  <el-descriptions-item label="参与人员">{{ mlist.projectperson }}
                  </el-descriptions-item>
                  <el-descriptions-item label="科研方向">{{ mlist.projectDir }}
                  </el-descriptions-item>
                  <!-- <el-descriptions-item label="附件">{{ mlist.awardEnclosure }}
                    </el-descriptions-item> -->
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="论文情况" name="sixth">
              <div id="teacherDetailList" v-for="m in thesislist" :key="m.thesisNo" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`论文名:${m.thesisName}`" :column="3" border>

                  <el-descriptions-item label="CN号">{{ m.thesisNO }}
                  </el-descriptions-item>

                  <el-descriptions-item label="论文名">{{ m.thesisName }}
                  </el-descriptions-item>
                  <el-descriptions-item label="发表时间">{{m.thesisDate }}
                  </el-descriptions-item>
                  <el-descriptions-item label="期刊类别">{{ m.thesisJour }}
                  </el-descriptions-item>
                  <el-descriptions-item label="论文类别">{{ m.category }}
                  </el-descriptions-item>
                  <el-descriptions-item label="第一作者">{{ m.thesisauthor }}
                  </el-descriptions-item>
                  <el-descriptions-item label="通讯作者">{{ m.thesisauthorTwo }}
                  </el-descriptions-item>
                  <el-descriptions-item label="附件">{{ m.thesisEnclosure }}
                  </el-descriptions-item>
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="著作情况" name="seventh">
              <div id="teacherDetailList" v-for="mlist in OpusList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`ISCN号:${mlist.opusNO}`" :column="3" border>

                  <!-- <el-descriptions-item label="著作编号">{{ mlist.opusNO }}
                    </el-descriptions-item> -->

                  <el-descriptions-item label="著作名">{{ mlist.opusName }}
                  </el-descriptions-item>
                  <el-descriptions-item label="出版社">{{ mlist.publicer }}
                  </el-descriptions-item>
                  <el-descriptions-item label="著作类别">{{ mlist.opuscategory }}
                  </el-descriptions-item>
                  <el-descriptions-item label="著作级别">{{ mlist.opuslevel }}
                  </el-descriptions-item>
                  <el-descriptions-item label="参与人员">{{ mlist.opusperson }}
                  </el-descriptions-item>
                  <el-descriptions-item label="著作详情">{{ mlist.opusdetail }}
                  </el-descriptions-item>
                  <el-descriptions-item label="附件">{{ mlist.opusEnclosure }}
                  </el-descriptions-item>
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="专利情况" name="eighth">
              <div id="teacherDetailList" v-for="mlist in PatentList" :key="mlist.patentNO" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`专利号:${mlist.patentNO}`" :column="3" border>

                  <!-- <el-descriptions-item label="专利号">{{ mlist.patentNO }}
                    </el-descriptions-item> -->

                  <el-descriptions-item label="专利名称">{{ mlist.patentName }}
                  </el-descriptions-item>

                  <el-descriptions-item label="专利等级">{{ mlist.patentlevel }}
                  </el-descriptions-item>
                  <el-descriptions-item label="专利类别">{{ mlist.patenttype }}
                  </el-descriptions-item>
                  <el-descriptions-item label="专利说明">{{ mlist.patentexplain }}
                  </el-descriptions-item>
                  <el-descriptions-item label="有效时间">{{ mlist.validtime }}
                  </el-descriptions-item>
                  <el-descriptions-item label="附件">{{ mlist.patentEnclosure }}
                  </el-descriptions-item>
                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="培训经历" name="ninth">
              <div id="teacherDetailList" v-for="mlist in TrainList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`${mlist.trainNO}`" :column="3" border>

                  <el-descriptions-item label="培训时间">{{ mlist.trainTime }}
                  </el-descriptions-item>

                  <el-descriptions-item label="培训地点">{{ mlist.trainadd }}
                  </el-descriptions-item>

                  <el-descriptions-item label="培训课题">{{ mlist.traintit }}
                  </el-descriptions-item>
                  <el-descriptions-item label="培训用书">{{ mlist.trainbook }}
                  </el-descriptions-item>
                  <el-descriptions-item label="培训单位">{{ mlist.trainposition }}
                  </el-descriptions-item>
                  <el-descriptions-item label="附件">{{ mlist.trainEnclosure }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="研究生导师" v-if="teacherBaseDetail.tutor =='是'" name="tenth">
              <div id="teacherDetailList" ref="teacherDetailList">
                <el-descriptions class="margin-top" title="具体信息" :column="3" border>

                  <el-descriptions-item label="研究课题">{{ teacherBaseDetail.tutortitle }}
                  </el-descriptions-item>

                  <el-descriptions-item label="所属专业系">{{ teacherBaseDetail.specialize }}
                  </el-descriptions-item>

                  <el-descriptions-item label="研究方向">{{ teacherBaseDetail.researchdir }}
                  </el-descriptions-item>
                  <el-descriptions-item label="所带学生数">{{ teacherBaseDetail.stuNum }}
                  </el-descriptions-item>
                  <el-descriptions-item label="学位">{{ teacherBaseDetail.degree }}
                  </el-descriptions-item>
                  <el-descriptions-item label="邮箱">{{ teacherBaseDetail.email }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>

            <el-tab-pane label="工作经历" name="elevant">
              <div id="teacherDetailList" v-for="mlist in WorkList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`${mlist.workadd}`" :column="3" border>

                  <el-descriptions-item label="就职日期">{{ mlist.intime }}
                  </el-descriptions-item>

                  <el-descriptions-item label="离职日期">{{ mlist.outtime }}
                  </el-descriptions-item>

                  <el-descriptions-item label="工作地点">{{ mlist.workadd }}
                  </el-descriptions-item>
                  <el-descriptions-item label="工作职位">{{ mlist.workposition }}
                  </el-descriptions-item>
                  <el-descriptions-item label="工作内容">{{ mlist.workcontent }}
                  </el-descriptions-item>
                  <el-descriptions-item label="附件">{{ mlist.trainEnclosure }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>
            <el-tab-pane label="教学工作" name="tewfw">
              <div id="teacherDetailList" v-for="mlist in Teach_workList" :key="mlist.index" ref="teacherDetailList">
                <el-descriptions class="margin-top" :title="`学院:${mlist.faculty}`" :column="3" border>

                  <el-descriptions-item label="学期">{{ mlist.term }}
                  </el-descriptions-item>

                  <!-- <el-descriptions-item label="学院">{{ mlist.faculty }}
                    </el-descriptions-item> -->

                  <el-descriptions-item label="课程名称">{{ mlist.courseName }}
                  </el-descriptions-item>
                  <el-descriptions-item label="授课班级">{{ mlist.Classname }}
                  </el-descriptions-item>
                  <el-descriptions-item label="授课时数">{{ mlist.teachHour }}
                  </el-descriptions-item>
                  <el-descriptions-item label="课程学分">{{ mlist.credit }}
                  </el-descriptions-item>

                </el-descriptions>
              </div>
            </el-tab-pane>
          </el-tabs>
        </el-tab-pane>
      </el-tabs>
      <!-- 同意按钮 -->
      <el-row style=" background-color: #ffffff;margin-top: 20px;">
        <div class="agree">
          <el-button type="primary" class="insertAndDelete_btn" @click="agree(teacherBaseDetail.teacherid)">同意
          </el-button>
          <el-button type="danger" class="insertAndDelete_btn" @click="disagree(teacherBaseDetail.teacherid)">不同意
          </el-button>
        </div>
      </el-row>
    </el-dialog>
  </el-container>
</template>

<script>
import axios from 'axios';
export default {
 name:'colexamine',
  data() {
    return {
      input:"",
      activeName: 'first',
      // 未审核的表格数据
      tableData: [],
      // 复选框的数据
      multipleSelection: [],
      // 未审核当前页码和总记录数
      currentPage:1,
      totalCount:2, 
      pageSize:5,
      // 接受学院的信息
      academyName:'',
      //审核页面的弹窗 
    dialogTeacherDetailVisible: false,
    //审核页面的数据表
      teacherBaseDetail: {},
      // 已经审核表的属性
      tableData2:[],
       // 已审核当前页码和总记录数
      currentPage2: 1,
      totalCount2: 2,
      pageSize2: 5,
      // 获取后端教师的拓展信息列表
      thesislist: [],
      Research_projectList: [],
      Annual_examinationList: [],
      AwardList: [],
      Honor_titleList: [],
      OpusList: [],
      Teach_workList: [],
      TrainList: [],
      PatentList: [],
      WorkList: [],
    }
   
    
  },
  mounted(){
  // this.academyName=
    this.academyName = this.$route.query.mark
   this.select1();
   this.select2();
  },
  methods: {
//  获取后端列表的方法
    getThesis(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getThesisList?id=" + id,
      }).then(resp => {
        this.thesislist = resp.data;
      })
    },
    getResearch_project(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getResearch_project?id=" + id,
      }).then(resp => {
        this.Research_projectList = resp.data;
      })
    },
    getAnnual_examination(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getAnnual_examination?id=" + id,
      }).then(resp => {
        this.Annual_examinationList = resp.data;
      })
    },
    getAward(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getAward?id=" + id,
      }).then(resp => {
        this.AwardList = resp.data;
      })
    },
    getHonor_title(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getHonor_title?id=" + id,
      }).then(resp => {
        this.Honor_titleList = resp.data;
      })
    },
    getOpus(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getOpus?id=" + id,
      }).then(resp => {
        this.OpusList = resp.data;
      })
    },
    getTeach_work(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getTeach_work?id=" + id,
      }).then(resp => {
        this.Teach_workList = resp.data;
      })
    },
    getTrain(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getTrain?id=" + id,
      }).then(resp => {
        this.TrainList = resp.data;
      })
    },
    getPatent(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getPatent?id=" + id,
      }).then(resp => {
        this.PatentList = resp.data;
      })
    },
    getWork(id) {
      axios({
        method: "get",
        url: " http://localhost:8888/Teachersystem/Teacher/getWork?id=" + id,
      }).then(resp => {
        this.WorkList = resp.data;
      })
    },
    select1(){
 // 获取后端需要审核的数据
    axios.get(
      " http://localhost:8888/Teachersystem/Examine/selectByPage?currentPage=" + this.currentPage + "&pageSize=" + this.pageSize +"&academyName="+this.academyName
       ).then(resp=> {
       this.tableData= resp.data.rows;
       this.totalCount=resp.data.totalCount;
       })
          },
    select2(){
      axios.get(
        " http://localhost:8888/Teachersystem/Examine/selectByPage2?currentPage2=" + this.currentPage2 + "&pageSize2=" + this.pageSize2 + "&academyName=" + this.academyName
      ).then(resp => {
        this.tableData2 = resp.data.rows;
        this.totalCount2 = resp.data.totalCount;
      })
    },
// 审核栏点击事件
      handleClick(tab, event) {

      console.log(tab, event);
      },
      // 复选框执行回调函数
      handleSelectionChange(val) {
      this.multipleSelection = val;

      },
      // 全部同意按钮
      agreeAll(){
      },
      agree(id){
              axios({
            method:"get",
            url:"http://localhost:8888/Teachersystem/Examine/agree?id="+id,
            }).then(resp =>{
            if(resp.data=="pass"){
            // 关闭窗口
            this.dialogTeacherDetailVisible= false,
            // 重新查询数据
            this.select1();
            this.select2();
            this.$message({
            message:'学院审核通过',
            type:'success'
            })
            }
            })
            },
      disagree(id) {
            axios({
              method: "get",
              url: "http://localhost:8888/Teachersystem/Examine/disagree?id="+id,
            }).then(resp => {
              if (resp.data == "nopass") {
                // 关闭窗口
                this.dialogTeacherDetailVisible = false,
                // 重新查询数据
                this.select1();
                this.$message({
              message: '学院审核不通过',
              type: 'danger'
                })
              }
            })
          },
      //分页
          handleSizeChange(val) {

          this.pageSize = val;
          this.select1();
          },
          handleCurrentChange(val) {

          this.currentPage = val;
          this.select1();
          },


//审核按钮显示教师详细信息界面
handleEdit(index, row) {
this.dialogTeacherDetailVisible = true;
this.teacherBaseDetail=row;
  this.getThesis(row.teacherid);
  this.getResearch_project(row.teacherid);
  this.getAnnual_examination(row.teacherid);
  this.getAward(row.teacherid);
  this.getHonor_title(row.teacherid);
  this.getOpus(row.teacherid);
  this.getTeach_work(row.teacherid);
  this.getTrain(row.teacherid);
  this.getPatent(row.teacherid);
  this.getWork(row.teacherid);
},
// 取消审核
cancle(index,row){
 var id=row.teacherid;
  axios({
    method: "get",
    url: "http://localhost:8888/Teachersystem/Examine/cancle?id=" + id,
  }).then(resp => {
    if (resp.data == "ok") {
        // 重新查询数据
        this.select2();
        this.select1();
      this.$message({
        message: '取消成功',
        type: 'success'
      })
    }
  })
},
    //已审核分页
    handleSizeChange2(val) {

      this.pageSize2 = val;
      this.select2();
    },
    handleCurrentChange2(val) {

      this.currentPage2 = val;
      this.select2();
    },
}

}
</script>

            <style>
              .head {
                float: right;
                margin-top: 30px;
              }

              .agree {
                float: left;
              }
            </style>
